/**
 * Program
 * 
 * @version 2012.01.12
 * @author  Bruno Miguel de Oliveira Tamer <bmotamer@gmail.com>
 */

#region C# Libraries

using System;

#endregion

#region XNA Libraries

using Microsoft.Xna.Framework;

#endregion

#region SDK Libraries

using main.sdk.display;
using main.sdk.input;
using main.sdk.scene;

#endregion

#region SRC Libraries

using main.src.scene;

#endregion

namespace main
{

    public sealed class Program : Game
    {

        #region Static Variables

        public static readonly Vector2               ScreenSize  = new Vector2(1024, 768);
        public static readonly Program               Self        = new Program();
        public static readonly GraphicsDeviceManager Graphics    = new GraphicsDeviceManager(Self);

        public static int Width
        {
            get { return (int)Program.ScreenSize.X; }
        }

        public static int Height
        {
            get { return (int)Program.ScreenSize.Y; }
        }

        private static GameTime _Time;

        public static GameTime Time
        {
                    get { return _Time;  }
            private set { _Time = value; }
        }

        #endregion

        #region Constructor

        public Program()
        {
            if (Self != null)
                throw new Exception("You can not instantiate Game!");
            // TODO: SETUP GRAPHICS VIA XML FILE
            Window.Title = "Soccer Hero";
        }

        private static void Main(string[] args) { Self.Run(); }

        #endregion

        #region Inherited Methods

        protected override void LoadContent()
        {
            Content.RootDirectory = "Content";
            Graphics.PreferredBackBufferWidth       = 1024;
            Graphics.PreferredBackBufferHeight      = 768;
            Graphics.SynchronizeWithVerticalRetrace = true;
            Graphics.ApplyChanges();
            Scene.Set(new Scene_Intro());
        }

        protected override void Update(GameTime gameTime)
        {
            _Time = gameTime;
            Gamepad.Update();
            Input.Update();
            if (Scene.Update())
                Exit();
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            Display.Draw();
            base.Draw(gameTime);
        }

        #endregion

    }

}